<?php class Userslog { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: userID
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $userID;

    /***
     * DB Fields: time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $time;

    /***
     * DB Fields: logData
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $logData;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: userID
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result userID
     **/
    function get_userID( ) {
        // returns the value of userID
        return $this->userID;
    }


    /***
     * Get value for field: time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result time
     **/
    function get_time( ) {
        // returns the value of time
        return $this->time;
    }


    /***
     * Get value for field: logData
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result logData
     **/
    function get_logData( ) {
        // returns the value of logData
        return $this->logData;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: userID
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param userID
     * @result void
     **/
    function set_userID( $userID ) {
        // sets the value of userID
        $this->userID = $userID;
    }

    /***
     * Set value for field: time
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param time
     * @result void
     **/
    function set_time( $time ) {
        // sets the value of time
        $this->time = $time;
    }

    /***
     * Set value for field: logData
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param logData
     * @result void
     **/
    function set_logData( $logData ) {
        // sets the value of logData
        $this->logData = $logData;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: userslog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param userID
     * @param time
     * @param logData
     * @result void
     **/
    function createnew_userslog( $id, $userID, $time, $logData ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $userID,
                      $time,
                      $logData); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("userslog", $_obj);
    }

    /***
     * Retrived an existing record: userslog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Userslog
     **/
    function get_userslog( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM userslog WHERE id = '$id'");

        $__userslogObj = new userslog();
        // return the retrived from the database

        // create a new object
        $__obj = new Userslog();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_userID($_resultSet[0]['userID']);
        $__obj->set_time($_resultSet[0]['time']);
        $__obj->set_logData($_resultSet[0]['logData']);


        return $__obj;
    }

    /***
     * Update an existing record: userslog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_userslog( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("userslog", "id = '$id'");
    }

    /***
     * Delete an existing record: userslog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_userslog( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("userslog", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: userslog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Userslog
     **/
    function list_userslog( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM userslog WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM userslog";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Userslog();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_userID($__rs['userID']);
            $__newObj->set_time($__rs['time']);
            $__newObj->set_logData($__rs['logData']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>